var i = 0
function foo() {
  if (i) return i
  i = new Date()
  return i
}



console.log(foo());
setTimeout(() => {
  console.log(foo());
}, 1000)